import { defineStore } from 'pinia';
// import { messageFn } from "../../utils"; 暂留
import {
  deptTreeApi, //获取当前用户所属部门-树形图
  regionListApi, //省市区联动对应表
  sewageAreaApi, //获取查询排污厂数据
  sewagePlantApi, //获取查询净化厂数据
  adminUserDictApi, //获取公用类接口--男女/证件/行业分类/用水类别
  contactTypeParamsDictApi, //查询联系人身份
  factoryMeterAllApi, //厂家筛选接口
  factoryMeterGetListApi, //查询厂商下的所有型号
  waterUsageApi, //获取用水类别
  usageGetAllApi, //获取水表用途
  bookListApi, //获取表册列表
  diameterListApi, //获取口径列表
  unitPriceApi, //获取计费单价数据
  AltimeterCardApi,//获取高拍仪--获取身份证
} from '/@/api/commonApi/index';
import {
  readingRoutePageApi, //片区分页
} from '/@/api/manageList/manageTableList';

export const commonStore = defineStore({
  id: 'commonAction-state',
  state: () => ({}),
  getters: {},
  actions: {
    /**
     * @description: deptTreeeAction //获取当前用户所属部门-树形图
     */
    async deptTreeeAction() {
      const deptTree = await deptTreeApi();
      return deptTree;
    },
    /**
     * @description: regionListAction //省市区联动对应表
     */
    async regionListAction(params: object) {
      const regionList = await regionListApi(params);
      return regionList;
    },
    /**
     * @description: sewageAreaAction //获取查询排污厂数据
     */
    async sewageAreaAction(params: object) {
      const sewageArea = await sewageAreaApi(params);
      return sewageArea;
    },
    /**
     * @description: sewagePlantAction //获取查询净化厂数据
     */
    async sewagePlantAction() {
      const sewagePlant = await sewagePlantApi();
      return sewagePlant;
    },
    /**
     * @description: adminUserDictAction //获取公用类接口--男女/证件/行业分类/用水类别
     */
    async adminUserDictAction(params: object) {
      const sewagePlant = await adminUserDictApi(params);
      return sewagePlant;
    },

    /**
     * @description: contactTypeParamsDictAction //查询联系人身份
     */
    async contactTypeParamsDictAction(params: object) {
      const contactTypeParams = await contactTypeParamsDictApi(params);
      return contactTypeParams;
    },

    /**
     * @description: 厂家筛选接口
     */
    async factoryMeterAllApiAction(params?: object) {
      const factoryMeterAllParams = await factoryMeterAllApi(params);
      return factoryMeterAllParams;
    },

    /**
     * @description: contactTypeParamsDictAction //查询厂商下的所有型号
     */
    async factoryMeterGetListAction(params: object) {
      const factoryMeterGetList = await factoryMeterGetListApi(params);
      return factoryMeterGetList;
    },
    /**
     * @description: waterUsageAction //获取用水类别
     */
    async waterUsageAction() {
      const waterUsage = await waterUsageApi();
      return waterUsage;
    },
    /**
     * @description: waterUsageAction //获取用水用途
     */
    async usageGetAllAction() {
      const usageGetAll = await usageGetAllApi();
      return usageGetAll;
    },
    /**
     * @description: unitPriceAction //获取计费单价数据
     */
    async unitPriceAction() {
      const unitPrice = await unitPriceApi();
      return unitPrice;
    },

    /**
     * @description: diameterListApi //获取口径列表
     */
    async diameterListAction() {
      const diameterList = await diameterListApi();
      return diameterList;
    },
    /**
     * @description: bookListApi //获取表册列表
     */
    async bookListAction(params?: object) {
      const bookList = await bookListApi(params);
      bookList.data?.forEach(item => {
        item.book_name = `${item.book_code}-${item.book_name}`
      })
      return bookList;
    },
    /**
     * @description: bookListApi //抄表片区分页
     */
    async readingRoutePageAction() {
      const adminReaders = await readingRoutePageApi();
      return adminReaders;
    },
    /**
     * @description: AltimeterCardApi //获取高拍仪身份证
     */
     async AltimeterCardAction() {
      const AltimeterCard = await AltimeterCardApi();
      return AltimeterCard;
    },

    
  },
});
